import { findTypeByValue, findTypeByLabel } from '@/utils/findType'
import * as types from "./types"

// 渠道Table
export const configTableFrame = [
  { 
    prop: "num", 
    label: "序号", 
    minWidth: "50px", 
    tooltip: true 
  },
  { 
    prop: "name", 
    label: "案例", 
    minWidth: "150px"
  },
  { 
    prop: "name", 
    label: "发布医生",
    minWidth: "100px",
    formatter: (row) => {
      return row.userVo.name;
    }
  },
  {
    prop: "status",
    label: "状态",
    minWidth: "100px",
    formatter: (row) => {
      return findTypeByValue(row.status, types.caseStatus);
    }
  },
  {
    prop: "disease",
    label: "患者基本信息",
    minWidth: "100px",
    tooltip: true
  },
  {
    prop: "change",
    label: "病史描述",
    minWidth: "100px",
    tooltip: true
  },
  {
    prop: "diagnosisTime",
    label: "案例处理体会",
    minWidth: "100px",
    tooltip: true
  },
  {
    prop: "hospital",
    label: "影像检查",
    minWidth: "100px",
    tooltip: true
  },
  {
    prop: "treatment",
    label: "疗效评估",
    minWidth: "100px",
    tooltip: true
  },
  {
    prop: "programme",
    label: "治疗方案",
    minWidth: "100px",
    tooltip: true
  },
  {
    prop: "commentNum",
    label: "评论数",
    minWidth: "100px"
  },
  {
    prop: "conference",
    label: "研讨会",
    minWidth: "100px",
    formatter: (row) => {
      return row.conferenceVo && row.conferenceVo.name ? '有' : '无';
    }
  },
  {
    prop: "labelList",
    label: "标签列表",
    minWidth: "100px",
    formatter: (row) => {
      if(row.labelList && row.labelList.length > 0){
        return row.labelList.join("、")
      }
      return row.labelList;
    }
  },
  { 
    label: "操作", 
    slotName: "operate", 
    fixed: "right",
    minWidth: "150px"
  },
];


export const searchFrame = [
  { 
    label: "案例名", 
    key: "name", 
    type: 1
  },
  { 
    label: "状态", 
    key: "status", 
    type: 2,
    options: types.caseStatus
  }
]
